/*    */ package com.zimbra.cs.mailclient.imap;
/*    */ 
/*    */ import java.util.ArrayList;
/*    */ import java.util.List;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public final class ImapUtil
/*    */ {
/*    */   public static long[] parseUidSet(String s)
/*    */   {
/* 27 */     if (s.length() == 0) {
/* 28 */       throw new IllegalArgumentException("Empty sequence set");
/*    */     }
/* 30 */     List<Long> uids = new ArrayList();
/* 31 */     for (String part : s.split(",")) {
/* 32 */       String[] range = part.split(":");
/* 33 */       if (range.length == 2) {
/* 34 */         long i = Long.parseLong(range[0]);
/* 35 */         long j = Long.parseLong(range[1]);
/* 36 */         if (i < j) {
/* 37 */           while (i <= j) uids.add(Long.valueOf(i++));
/*    */         }
/* 39 */         while (j <= i) uids.add(Long.valueOf(j++));
/*    */       }
/*    */       else {
/* 42 */         uids.add(Long.valueOf(Long.parseLong(part)));
/*    */       }
/*    */     }
/* 45 */     long[] res = new long[uids.size()];
/* 46 */     for (int i = 0; i < res.length; i++) {
/* 47 */       res[i] = ((Long)uids.get(i)).longValue();
/*    */     }
/* 49 */     return res;
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/mailclient/imap/ImapUtil.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */